package com.kotlinvben.vo

import com.kotlinvben.entity.Department
import com.kotlinvben.enumeration.Gender
import com.kotlinvben.enumeration.Status
import jakarta.validation.constraints.Email
import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.Pattern
import jakarta.validation.constraints.Size

/**
 * User Value Object for receiving frontend parameters
 */
data class UserCreateVO(
    val id: Long? = null,

    @field:NotBlank(message = "用户名不能为空")
    @field:Size(min = 2, max = 50, message = "用户名长度必须在2-50个字符之间")
    val username: String,

    @field:NotBlank(message = "用户真实名称不能为空")
    @field:Size(min = 2, max = 50, message = "用户真实名称长度必须在2-50个字符之间")
    val realName: String,

    @field:NotBlank(message = "密码不能为空")
    @field:Size(min = 6, max = 50, message = "密码长度必须在6-50个字符之间")
    var password: String,

    @field:NotBlank(message = "邮箱不能为空")
    @field:Email(message = "邮箱格式不正确")
    @field:Size(max = 50, message = "邮箱长度不能超过50个字符")
    val email: String,

    var gender: Gender = Gender.UNKNOWN,

    @field:NotBlank(message = "手机号不能为空")
    @field:Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
    val phone: String,

    val address: String? = null,

    val status: Int = Status.ENABLED.code,

    val departmentId: Long? = null,

    val remark: String? = null,

    var department: Department? = null,

    val roleIds: List<Long>? = null,
)